﻿using System.Diagnostics.CodeAnalysis;

namespace Practise01
{
    internal class Program
    {
        const int COUNT = 1000;
        const int STARTOFNUMBER = 0;
        const int ENDOFNUMBER = 100;
        const string FILENAME = "D:\\Practise.txt";
        
        /// <summary>
     /// 输出一千个在0到100之间的随机数，并存入文本文档
     /// </summary>
     /// <param name="args"></param>
        static void Main(string[] args)
        {
            //创建随机数
            Random random = new Random();
            //如果文件以及存在，则删除
            if (System.IO.File.Exists(FILENAME))
                { File.Delete(FILENAME); }
            using (StreamWriter writer = new StreamWriter(FILENAME))
            {
                //循环
                for (int j = 0; j < COUNT; j++)
                {

                    for (int i = 0; i < 101; i++)
                    {
                        int randomNumber = random.Next(0, 101);
                        writer.WriteLine(randomNumber);
                    }
                }
            }
        }
    }
}
